<?php
/**
 * 调试类
 *
 * @package if
 * @subpackage core
 * @since 1.0
 */
class IDebug {
	private static $lastTime = -1;
	
	static function debug($mark = null) {
		if (!function_exists("xdebug_time_index")) {
			return;
		}
		$time = xdebug_time_index();
		$spent = round($time - self::$lastTime, 5);
		if ($spent > 0.001) {
			$spent = "<font color=\"red\">{$spent}</font>";
		}
		echo "debug: {$mark}: " . xdebug_call_file() . ":" . xdebug_call_line() . " - " . $spent . "s/" . round($time, 5) . "s" . " - " . round(xdebug_peak_memory_usage()/1024/1024, 2) . "M<br/>\n";
		self::$lastTime = $time;
	}
}

?>